package com.example.demo.support;

import com.google.common.collect.Maps;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;
import java.util.Map;

@EqualsAndHashCode(callSuper = true)
@Data
public class IMAccountMultiAddedResponse extends IMBaseResponse {

    private static final Map<Integer, String> ERROR_CODE_MESSAGE = Maps.newHashMap();

    static {
        ERROR_CODE_MESSAGE.put(70169, "服务端内部超时，请稍后重试");
        ERROR_CODE_MESSAGE.put(70202, "服务端内部超时，请稍后重试");
        ERROR_CODE_MESSAGE.put(70398, "帐号数超限，如需创建多于100个帐号，请将应用升级为专业版，具体操作指引请参见 购买指引");
        ERROR_CODE_MESSAGE.put(70402, "参数非法，请检查必填字段是否填充，或者字段的填充是否满足协议要求");
        ERROR_CODE_MESSAGE.put(70403, "请求失败，需要 App 管理员权限");
        ERROR_CODE_MESSAGE.put(70500, "服务器内部错误，请稍后重试");
    }

    private List<String> FailAccounts;

    @Override
    public String transformErrorCode(Integer errorCode) {
        String message = super.transformErrorCode(errorCode);
        if (message != null) {
            return message;
        }
        return ERROR_CODE_MESSAGE.getOrDefault(errorCode, "未知错误");
    }
}
